<html>
<head>
    <title>登录界面</title>
    <link rel="stylesheet" href="/template/static/bootstrap/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="/bootstrap/bootstrap-table/bootstrap-table.min.css">
    <link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css">
    <script src="/jquery/jquery.min.js"></script>
    <script src="/bootstrap/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="/bootstrap/bootstrap-table/bootstrap-table.js"></script>
    <script src="/bootstrap/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <script src="/bootstrap/bootstrap-table/export/bootstrap-table-export.js"></script>
    <script src="/bootstrap/bootstrap-table/export/tableExport.js"></script>
    <script src="/layer/layer.js"></script>
    <script src="/bootstrap/bootstrap-valid/bootstrapValidator.min.js"></script>
    <script src="/bootstrap/bootstrap-valid/zh_CN.js"></script>
</head>
<body>
<form class="form-horizontal" role="form" method="post" onsubmit="return doLogin();" id="loginForm">
    <div class="form-group">
        <label class="col-sm-3 control-label">用户名</label>
        <div class="col-sm-3">
            <input type="text" class="form-control" name="username">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">密码</label>
        <div class="col-sm-3">
            <input type="text" class="form-control" name="password">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-3 col-sm-10">
            <button type="submit" class="btn btn-default">登录</button>
        </div>
    </div>
</form>
<script>
    function doLogin() {
        var obj = $("#loginForm").serializeArray();
        var param = {};
        $.each(obj, function(i, field){
            param[field.name]=field.value;
        });
        $.ajaxSetup({
            async: false
        });
        var loginFlag;
        $.post("/doLogin", param ,
            function(flag){
            loginFlag = flag;
        });
        if (!loginFlag) {
            layer.msg('登录失败,用户名或密码错误', {icon: 2});
            return false;
        }
        location.href = "/resume/index";
        return false;
    }
</script>
</body>
</html>